<?php
    //echo $this->Html->css(array('screen.css', 'jquery-ui-1.8.9.custom.css', 'ui-timepicker.css'),'stylesheet', array('media'=>'screen, projection'));
    //echo $this->Html->css(array('print.css'),'stylesheet', array('media'=>'print'));
    //echo $this->Html->script(array('jquery-ui-1.8.9.custom.min.js', 'ui.timepicker.js'));
        //echo $this->Html->script(array('jquery-ui-1.8.9.custom.min.js'));
?>

<script type="text/javascript"> 
	$(function() {
       $('#stime').timepicker();
	});
</script>
<?php
//echo $form->create('User', array('action' => 'login'));
//echo $form->input('email_address',array('between'=>'<br>','class'=>'text'));
//echo $form->input('password',array('between'=>'<br>','class'=>'text'));
//echo $form->end('Sign In');
//
$id = $jb[0]['Job']['id'];
//echo pr($jb);
//echo $id;
$dayformat = date("Y-m-d H:i:s", strtotime($jb[0]['Job']['sdate']));
$daypart = date("Y-m-d", strtotime($dayformat));
$hourpart = date("H:i:s", strtotime($dayformat));
$edayformat = date("Y-m-d H:i:s", strtotime($jb[0]['Job']['edate']));
$edaypart = date("Y-m-d", strtotime($edayformat));
$ehourpart = date("H:i:s", strtotime($edayformat));
$dur = $ehourpart - $hourpart;
?>
<!--
<header>
    <ul class="action-buttons clearfix fr">
        <li><a href="documentation/index.html" class="button button-gray no-text help" rel="#overlay">Help<span class="help"></span></a></li>
    </ul>
    <h2>Edit a Job</h2>
</header>
-->
<div class="center">

<?php echo $form->create('Job', array('action' => 'jedit/' . $id)); ?>  
      
  
<!-- the tabs -->
                
                
                <div class="tabbed-pane">
                    <ul class="tabs">
                        <li><a href="#">Task Dates</a></li>
                        <li><a href="#">Needed Skills</a></li>
                        <li><a href="#">Task Description</a></li>
                    </ul>

                    <!-- tab "panes" -->
<div class="panes clearfix">

      
<section>
        <fieldset class="form grid_6">
        
        <label>Title <em>*</em><small>Enter a title</small></label><?php echo $form->text('Job.title', array('type' => 'text', 'value' => $jb[0]['Job']['title']))?>
        <label>Start Time <em>*</em><small>Enter a start time</small></label><?php echo $form->text('Job.stime', array('id' => 'stime', 'value' => $hourpart)); ?>
        <label>Start Date <em>*</em><small>Enter a start date</small></label><?php echo $form->text('Job.sdate', array('type'=>'date', 'value' => $daypart))?>
        
        
    <!--</form>-->
</fieldset>

</section>
<section>
                        <fieldset style="vertical-align: baseline; clear: left;">
                            
                            <div id="skillwrapper">
                            <?php 
                                    //echo pr($selected);
                                    $options = array();
                                    $selected = array();
                                    foreach($skill as $sk)
                                    {
                                       $options[$sk['Skill']['id']] = $sk['Skill']['name'];              
                                    }
                                    foreach ($jb[0]['Skill'] as $sk)
                                    {
                                        $selected[] = $sk['id'];
                                    }
                                    //foreach ($profile['Skill'] as $sk)
                                 echo $form->input('Skill', array('label' => '', 'multiple' => 'checkbox', 'options' => $options, 'selected' => $selected));
                            ?>
                            </div>
                        </fieldset>
</section>

<section>
<fieldset class="form grid_6">

<label>Duration<small>Number of Hours</small> </label><?php echo $form->text('Job.etime', array('id' => 'etime', 'value' => $dur)); ?>
        <label>Task Instructions <em>*</em><small>Enter the task instructions</small></label><?php echo $form->textarea('Job.description', array('value' => $jb[0]['Job']['description'], 'class' => 'full')); ?>
        <label>Special Instructions <em>*</em><small>Instructions for the Volunteer</small></label><?php echo $form->textarea('Job.hiddendetails', array('value' => $jb[0]['Job']['hiddendetails'], 'class' => 'full')); ?>
</fieldset>
</section>

</div>
</div>
</div>
<section class="container_6 clearfix">

<div class="action">
        <?php echo $form->button('<span class="accept"></span>Save Changes', array('class' => 'button button-gray accept')); ?>
        <?php echo $form->end(); ?>
        </div>
 <!--
//<div class="action">
//            <button class="button button-gray" type="submit"><span class="accept"></span>OK</button>
//            <button class="button button-gray" type="reset">Reset</button>
//       
--> </div>
</section>
